package per.turtle.system.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import per.turtle.common.core.constant.ServiceNameConstants;
import per.turtle.common.core.web.entity.CommonResult;
import per.turtle.system.feign.factory.RemoteScopeFallbackFactory;

import java.util.List;

/**
 * 数据权限服务
 *
 * @author turtle
 */
@FeignClient(contextId = "remoteScopeService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteScopeFallbackFactory.class)
public interface RemoteScopeService {

    /**
     * 根据角色id获取部门id
     *
     * @param roleId 角色id
     * @return 结果
     */
    @GetMapping("dept/getDeptIdsByRole/{roleId}")
    CommonResult<List<String>> getDeptIdsByRole(@PathVariable("roleId") String roleId);

    /**
     * 根据角色部门id获取部门及下属部门id
     *
     * @param deptId 角色部门id
     * @return 结果
     */
    @GetMapping("dept/getDeptIdsWithChildByUser/{deptId}")
    CommonResult<List<String>> getDeptIdsWithChildByUser(@PathVariable("deptId") String deptId);

}
